c# to json online

181

object to json c# -

using Newtonsoft.Json;

var jsonString = JsonConvert.SerializeObject(obj);

convert json to c# -

// To convert json datetime string to datetime object in c#
// Try this

// For instance if the json string is in this format: "/Date(1409202000000-0500 )/"
// Then wrap it like below

string sa = @"""/Date(1409202000000-0500)/""";

// Create a new instance of datetime object
DateTime dt = new DateTime();

// Deserialize the json string to datetime object
dt = JsonConvert.DeserializeObject<DateTime>(sa);


// Output
// dt = "2014-08-28 3.00.00 PM"

Comments

Submit
2 Comments
  • 17/3/2023 11:30 - Europe/Rome


    public class AdventureDetailDataModel
    {
        public List <AdventureBranch> Adventure { get; set; }
    }

    public class AdventureBranch
    {
        public int ID { get; set; }
        public string Title { get; set; }
        public string Mp3 { get; set; }
        public string Text { get; set; }
        public string Image { get; set; }
      
       public BranchType Type { get; set; }

      public List<BranchOption> Options { get; set; }


    }

    public class BranchOption
    {
        public string Description { get; set; }

        public List<SkillCheck> SkillCheck { get; set; }
        public int NextBranchID { get; set; }
    }

    public class BranchType
    {
        public TypeOfBranch Type { get; set; }
        public bool IsVisitable { get; set; }

        public   LightLevel LightLevel { get; set; }
    }

   


  • 26/6/2023 14:11 - Asia/Krasnoyarsk

namespace WireNetSystem
{
    public class Customer
    {
        public string Name { get; set; } = "";
        public List<Service> Services { get; set; } = new List<Service>();
    }

}